<?php

namespace App\Observers;

use App\Model\Activity;

// creating, created, updating, updated, saving,
// saved,  deleting, deleted, restoring, restored

class ActivityObservers
{
   //回复内容后处理事件 添加加复内容后，对应的话题的回复数加1
    public function saving(Activity $activity)
    {
        $activity->status = 2;

    	/*$now = time();
    	//活动未开始
    	if ($activity->start_at > $now) {
    		$activity->status = 0;
    	//活动预热
    	}else if ($now < $activity->start_at && ($now + 3*3600) > $activity->start_at) {
    		$activity->status = 1;
    	//活动进行中
    	}else if($activity->start_at < $now  &&  $now < $activity->end_at) {
    		$activity->status = 2;
    	}else { //活动结束
    		$activity->status = 3;
    	}*/

    }
}